const appId = 'wx88538170a82c067b'
const appSecret = '5ad032ae3a91448f4aed71e588947522'


const jwt = require("jsonwebtoken"); //webjsontoken
//生成token
function getToken(openid) {
	// sign(加密数据，加密辅助，过期时间(单位/s))
	return jwt.sign({
		openid
	}, appSecret, {
		expiresIn: 60 * 60 * 24 * 30
	});
}
//解密token
function verifyToken(token) {
	return jwt.verify(token, appSecret, (err, decode) => {
		return decode
	})
}

module.exports = {
	appId,
	appSecret,
	getToken,
	verifyToken
}